import { req } from '@/util/request'
import type { ResData } from '@/types/index'
import type { Captcha, UserLoginInfo, SignUpInfo } from '@/types/sign'

export function getCaptcha(): ResData<Captcha> {
  return req.get('/captcha')
}
export const signUp = (info: SignUpInfo): ResData<any> => {
  info = JSON.parse(JSON.stringify(info))
  delete info.repassword
  return req.post('/sign/up', info)
}
export function login(info: UserLoginInfo): ResData<string> {
  return req.post('/sign/in', info)
}

export function roleSign(rid: number): ResData<string> {
  return req.get('/sign/role', {
    params: {
      rid
    }
  })
}
